import { LOGIN, LOGOUT, SET_USER_INFO } from '../types';

const initState = {
  isAuthenticated: false,
  info: null
};

export default (state = initState, action = {}) => {
  switch (action.type) {
    case LOGIN:
      return {
        ...state,
        isAuthenticated: true
      };
    case LOGOUT:
      return initState;
    case SET_USER_INFO:
      return {
        ...state,
        info: action.info
      }
    default: return state;
  }
};
